package lec07datastructure.v1;

public class MyStack {
    int[] data = new int[100];
    int top = -1;


    void push(int x) {
        data[++top] = x;
    }

    int peek() {
        return data[top];
    }

    void pop() {
        --top;
    }

    public static void main(String[] args) {
        MyStack s = new MyStack();
        for (int i = 0; i < 10; i++) {
            s.push(i);
        }
        while (s.top != -1) {
            System.out.println(s.peek());
            s.pop();
        }
    }

}
